//空间信息(json)
var spaceInfo=[50,100,200,500,1000];
//空间信息(json)ISP
var spaceInfo1=[10,20,30,50,100];
//空间信息(json)IDC
var spaceInfo2=[10,20,30,50,100,300,500,1024];
//时间信息(json)
var periodInfo=[1,2,3,4,5,6,7,8,9,10,11,12];
//时间信息(json)ISP
var periodInfo1=[1,2,3,4,5,6];
//时间信息(json)IDC
var periodInfo2=[1,2,3,4,5,6];
//var unitIP=100;//IP单价
var unitIP=$("#ipPrice").val()//IP单
var flag = "one";

//ISP单线价格
//var price1=[13000,22000,32000,42666.67,53333.34,64000];//10M
//var price2=[22000,41000,60000,80000,100000,120000];//20M
//var price3=[35000,62000,90000,120000,150000,180000];//30M
//var price4=[42000,80000,116000,154666.67,193333.34,232000];//50M
//var price5=[80000,150000,215000,286666.67,358333.34,430000];//100M
var price1=$("#price1").val().replace('[','').replace(']','').split(',');//10M
var price2=$("#price2").val().replace('[','').replace(']','').split(',');//20M
var price3=$("#price3").val().replace('[','').replace(']','').split(',');//30M
var price4=$("#price4").val().replace('[','').replace(']','').split(',');//50M
var price5=$("#price5").val().replace('[','').replace(']','').split(',');//100M
//ISP赠送IP数量
var num1=[4,4,8,8,16]
//ISP双线价格
//var P1=(41000/3).toFixed(2);
//var P2=(65000/3).toFixed(2);
//var P3=(11000/3).toFixed(2);
//var P4=(155000/3).toFixed(2);
//var P5=(280000/3).toFixed(2);
//var price6=[16000,30000,41000,P1*4,P1*5,82000];//10M
//var price7=[25000,45000,65000,P2*4,P2*5,130000];//20M
//var price8=[40000,75000,110000,P3*4,P3*5,220000];//30M
//var price9=[55000,106000,155000,P4*4,P4*5,310000];//50M
//var price10=[100000,192000,280000,P5*4,P5*5,560000];//100M
var price6=new Array(price1[0]*1.5,price1[1]*1.5,price1[2]*1.5,price1[3]*1.5,price1[4]*1.5,price1[5]*1.5);//10M
var price7=new Array(price2[0]*1.5,price2[1]*1.5,price2[2]*1.5,price2[3]*1.5,price2[4]*1.5,price2[5]*1.5);//20M
var price8=new Array(price3[0]*1.5,price3[1]*1.5,price3[2]*1.5,price3[3]*1.5,price3[4]*1.5,price3[5]*1.5);//30M
var price9=new Array(price4[0]*1.5,price4[1]*1.5,price4[2]*1.5,price4[3]*1.5,price4[4]*1.5,price4[5]*1.5);//50M
var price10=new Array(price5[0]*1.5,price5[1]*1.5,price5[2]*1.5,price5[3]*1.5,price5[4]*1.5,price5[5]*1.5);//100M


//IDC单线价格
var price11=[1000,2000,3000,5000,8000,12000,18000,30000];//带宽的月单价
//IDC双线价格
var price13=[1500,2500,3500,7500,12000,18000,27000,45000];//带宽的月单价
//机柜的月单价
var price12=5000; //10A42U
var price14=6000; //13A42U
//机架的单价（280元/U/月）
var price15=280;
//IDC赠送的IP数量
var num2=[1,1,1,1,2,4,8,16];


$(function(){
    //ISP单击单线或者双线时
	$("input[name=optionsRadiosinline]").change(function(){
		if($("input[name=optionsRadiosinline]:checked").val()=="1"){
			flag="one";
		}else{
			flag="two";         
	   }
       stairPrice_1();
    });

    //ISP输入购买IP数量时
    $('#buy_count_1').blur(function(){
        stairPrice_1();
    });

  //IDC单击单线或者双线时
   $("input[name=optionsRadiosinline1]").click(function(){
        if($(this).val()=='one'){
            flag='one';
        }else{
            flag="two";
        }
        stairPrice_2();
   });
    //IDC输入购买IP数量时
    $('#buy_count_2').blur(function(){
        stairPrice_2();
    });    

   $('#options').change(function(){
        var index=$(this).children('option:selected').index();
        if(index==1){
            $('#option-0').show().siblings('.option-1').hide();
        }else if(index==2){
            $('#option-1').show().siblings('.option-1').hide();          
        }
        stairPrice_2();
    });
   //机柜状态下
   $('#option-1 select').change(function(){
            stairPrice_2();    
    });   
    //IDC输入购买机架数量时
    $('#buy_count_4').blur(function(){
        stairPrice_2();
    });    


//动态生成滑动条区间尺码
var spaceHtml=$("<div class='unitdiv'></div>");//M&nbsp; slider
var spaceHtml_1=$("<div class='unitdiv'></div>");//M&nbsp; slider
var spaceHtml_2=$("<div class='unitdiv'></div>");//M&nbsp; slider
var timeHtml=$("<div class='unitdiv' ></div>");//&nbsp; slider_time
var timeHtml_1=$("<div class='unitdiv' ></div>");//&nbsp; slider_time
var timeHtml_2=$("<div class='unitdiv' ></div>");//&nbsp; slider_time
var spaceWidth=parseInt(100/spaceInfo.length);
var spaceWidth1=parseInt(100/spaceInfo1.length);//ISP
var spaceWidth2=parseInt(100/spaceInfo2.length);//IDC
var timeWidth=Math.floor(100/periodInfo.length);
var timeWidth1=Math.floor(100/periodInfo1.length);//ISP
var timeWidth2=Math.floor(100/periodInfo2.length);//IDC


//空间
for(var i=0;i<spaceInfo.length;i++){
var prototype=$(spaceHtml).clone();
prototype.html(spaceInfo[i]+"M&nbsp;").css("width",spaceWidth-0.1+"%");
$("#slider").append(prototype);
if(i==spaceInfo.length-1)
$("#slider .unitdiv:last").css("border-right","0px");
}

//ISP带宽
for(var i=0;i<spaceInfo1.length;i++){
var prototype=$(spaceHtml_1).clone();
prototype.html(spaceInfo1[i]+"M&nbsp;").css("width",spaceWidth1-0.1+"%");
$("#slider_1").append(prototype);
if(i==spaceInfo1.length-1)
$("#slider_1 .unitdiv:last").css("border-right","0px");
}

//IDC带宽
for(var i=0;i<spaceInfo2.length;i++){
var prototype=$(spaceHtml_2).clone();
prototype.html(spaceInfo2[i]+"M&nbsp;").css("width",spaceWidth2-0.1+"%");
$("#slider_2").append(prototype);
if(i==spaceInfo2.length-1)
$("#slider_2 .unitdiv:last").css("border-right","0px");
}

//时间
for(var i=0;i<periodInfo.length;i++){
var prototype=$(timeHtml).clone();
// prototype.html(i+1+"月 &nbsp;").css("width",timeWidth-1+"%");
prototype.html(periodInfo[i]+"月&nbsp;").css("width",timeWidth+"%");
$("#slider_time").append(prototype);//扩容续租
$("#slider_cache_time_cdn").append(prototype).clone();//加速界面
if(i==periodInfo.length-1){
$("#slider_time .unitdiv:last").css("border-right","0px");//扩容续租
$("#slider_cache_time_cdn .unitdiv:last").css("border-right","0px");}//加速界面
}

//ISP时长
for(var i=0;i<periodInfo1.length;i++){
var prototype=$(timeHtml_1).clone();
// prototype.html(i+1+"月 &nbsp;").css("width",timeWidth-1+"%");
prototype.html(periodInfo1[i]+"年&nbsp;").css("width",timeWidth1+"%");
$("#slider_time_1").append(prototype);
if(i==periodInfo1.length-1){
$("#slider_time_1 .unitdiv:last").css("border-right","0px");}
}
//IDC时长
for(var i=0;i<periodInfo2.length;i++){
var prototype=$(timeHtml_2).clone();
// prototype.html(i+1+"月 &nbsp;").css("width",timeWidth-1+"%");
prototype.html(periodInfo2[i]+"年&nbsp;").css("width",timeWidth2+"%");
$("#slider_time_2").append(prototype);//扩容续租
if(i==periodInfo2.length-1){
$("#slider_time_2 .unitdiv:last").css("border-right","0px");}//扩容续租
}
});
  //计价
function stairPrice(){

   var price=10;//  10元/M/月

    create_section();
    
    //区间段
    var spaceSectionNum=$("#spaceSectionNum").val();
    var timeSectionNum=$("#timeSectionNum").val();
    //购买量
    var spaceTotal=$("#tot_volume").val();
    var timeTotal=$("#buy_num").val();
    
    var cost_money=price*spaceTotal*timeTotal;
   
    
    var gnum = '';
    var gstr = '';
          timeTotal=(timeTotal>=1?timeTotal:1);
          for(var k in periodInfo)
          {
                    if(timeTotal==periodInfo[k]){
                       gnum = periodInfo[k];
                      
                      break;
                      }
          }


             //计算费用
            var cost_money_str = '存储容量：'+spaceTotal+'M ('+price+'元/M/月) * 使用时长：'+timeTotal+'个月';//+'='+cost_money+'元';;
            //+'= 总计：'+cost_money;
            var pDate = getPDate(parseInt(timeTotal-1));//有效期限
           

             cost_money_str+='= 总计：<span class="colC"><em class="f20">'+cost_money+'</em></span> 元';
    
            //模板赋值
            $("#cost_money").val(cost_money);//隐蔽域存放金额
            $("#pDate").html(pDate);
            $("#cost_money_show").html(cost_money_str);
            $("#cost_money_show").show();
            $(".i-month").html(timeTotal)

    }
  
  //ISP计价
  function stairPrice_1(){
	    var total_1;
	    var cost_money_1;
	    var cost_money_1_1;
	   var  cost_money_str_1_1;

	    create_section_1();
	    
	    //区间段
	    var spaceSectionNum=$("#spaceSectionNum").val();
	    var timeSectionNum=$("#timeSectionNum").val();
	    //购买量
	    var spaceTotal_1=$("#tot_volume_1").val();
	    var timeTotal_1=$("#buy_num_1").val();
	    var count_1=$('#buy_count_1').val();
	    if(count_1==''){
	        count_1=0;
	    }

		 if(flag=="one"){
	      switch(spaceTotal_1){
	        case '10':
	        $('.i-ip').html(num1[0]);
	        if(timeTotal_1==periodInfo1[0]){
	            total_1=parseFloat(price1[0]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price1[0];
	        }else if(timeTotal_1==periodInfo1[1]){
	            total_1=parseFloat(price1[1]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price1[1];
	        }else if(timeTotal_1==periodInfo1[2]){
	            total_1=parseFloat(price1[2]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price1[2];
	        }else if(timeTotal_1==periodInfo1[3]){
	            total_1=parseFloat(price1[3]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price1[3];
	        }else if(timeTotal_1==periodInfo1[4]){
	            total_1=parseFloat(price1[4]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price1[4];
	        }else if(timeTotal_1==periodInfo1[5]){
	            total_1=parseFloat(price1[5]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price1[5];
	        }
	        break;

	        case '20':
	        $('.i-ip').html(num1[1]);
	        if(timeTotal_1==periodInfo1[0]){
	            total_1=parseFloat(price2[0]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price2[0];
	        }else if(timeTotal_1==periodInfo1[1]){
	            total_1=parseFloat(price2[1]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price2[1];
	        }else if(timeTotal_1==periodInfo1[2]){
	            total_1=parseFloat(price2[2]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price2[2];
	        }else if(timeTotal_1==periodInfo1[3]){
	            total_1=parseFloat(price2[3]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price2[3];
	        }else if(timeTotal_1==periodInfo1[4]){
	            total_1=parseFloat(price2[4]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price2[4];
	        }else if(timeTotal_1==periodInfo1[5]){
	            total_1=parseFloat(price2[5]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price2[5];
	        }
	        break;

	        case '30':
	        $('.i-ip').html(num1[2]);
	        if(timeTotal_1==periodInfo1[0]){
	            total_1=parseFloat(price3[0]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price3[0];
	        }else if(timeTotal_1==periodInfo1[1]){
	            total_1=parseFloat(price3[1]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price3[1];
	        }else if(timeTotal_1==periodInfo1[2]){
	            total_1=parseFloat(price3[2]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price3[2];
	        }else if(timeTotal_1==periodInfo1[3]){
	            total_1=parseFloat(price3[3]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price3[3];
	        }else if(timeTotal_1==periodInfo1[4]){
	            total_1=parseFloat(price3[4]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price3[4];
	        }else if(timeTotal_1==periodInfo1[5]){
	            total_1=parseFloat(price3[5]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price3[5];
	        }
	        break;

	        case '50':
	        $('.i-ip').html(num1[3]);
	        if(timeTotal_1==periodInfo1[0]){
	            total_1=parseFloat(price4[0]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price4[0];
	        }else if(timeTotal_1==periodInfo1[1]){
	            total_1=parseFloat(price4[1]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price4[1];
	        }else if(timeTotal_1==periodInfo1[2]){
	            total_1=parseFloat(price4[2]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price4[2];
	        }else if(timeTotal_1==periodInfo1[3]){
	            total_1=parseFloat(price4[3]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price4[3];
	        }else if(timeTotal_1==periodInfo1[4]){
	            total_1=parseFloat(price4[4]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price4[4];
	        }else if(timeTotal_1==periodInfo1[5]){
	            total_1=parseFloat(price4[5]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price4[5];
	        }
	        break;
	        case '100':
	        $('.i-ip').html(num1[4]);
	        if(timeTotal_1==periodInfo1[0]){
	            total_1=parseFloat(price5[0]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price5[0];
	        }else if(timeTotal_1==periodInfo1[1]){
	            total_1=parseFloat(price5[1]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price5[1];
	        }else if(timeTotal_1==periodInfo1[2]){
	            total_1=parseFloat(price5[2]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price5[2];
	        }else if(timeTotal_1==periodInfo1[3]){
	            total_1=parseFloat(price5[3]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price5[3];
	        }else if(timeTotal_1==periodInfo1[4]){
	            total_1=parseFloat(price5[4]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price5[4];
	        }else if(timeTotal_1==periodInfo1[5]){
	            total_1=parseFloat(price5[5]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price5[5];
	        }
	        break;

		 }}else{
	   switch(spaceTotal_1){
		
	        case '10':
	        $('.i-ip').html(num1[0]);
			
	        if(timeTotal_1==periodInfo1[0]){
	            total_1=parseFloat(price6[0]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price6[0];
	        }else if(timeTotal_1==periodInfo1[1]){
	            total_1=parseFloat(price6[1]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price6[1];
	        }else if(timeTotal_1==periodInfo1[2]){
	            total_1=parseFloat(price6[2]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price6[2];
	        }else if(timeTotal_1==periodInfo1[3]){
	            total_1=parseFloat(price6[3]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price6[3];
	        }else if(timeTotal_1==periodInfo1[4]){
	            total_1=parseFloat(price6[4]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price6[4];
	        }else if(timeTotal_1==periodInfo1[5]){
	            total_1=parseFloat(price6[5]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price6[5];
	        }
	        break;

	        case '20':
	        $('.i-ip').html(num1[1]);
	        if(timeTotal_1==periodInfo1[0]){
	            total_1=parseFloat(price7[0]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price7[0];
	        }else if(timeTotal_1==periodInfo1[1]){
	            total_1=parseFloat(price7[1]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price7[1];
	        }else if(timeTotal_1==periodInfo1[2]){
	            total_1=parseFloat(price7[2]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price7[2];
	        }else if(timeTotal_1==periodInfo1[3]){
	            total_1=parseFloat(price7[3]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price7[3];
	        }else if(timeTotal_1==periodInfo1[4]){
	            total_1=parseFloat(price7[4]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price7[4];
	        }else if(timeTotal_1==periodInfo1[5]){
	            total_1=parseFloat(price7[5]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price7[5];
	        }
	        break;

	        case '30':
	        $('.i-ip').html(num1[2]);
	        if(timeTotal_1==periodInfo1[0]){
	            total_1=parseFloat(price8[0]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price8[0];
	        }else if(timeTotal_1==periodInfo1[1]){
	            total_1=parseFloat(price3[1]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price8[1];
	        }else if(timeTotal_1==periodInfo1[2]){
	            total_1=parseFloat(price8[2]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price8[2];
	        }else if(timeTotal_1==periodInfo1[3]){
	            total_1=parseFloat(price8[3]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price8[3];
	        }else if(timeTotal_1==periodInfo1[4]){
	            total_1=parseFloat(price8[4]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price8[4];
	        }else if(timeTotal_1==periodInfo1[5]){
	            total_1=parseFloat(price8[5]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price8[5];
	        }
	        break;

	        case '50':
	        $('.i-ip').html(num1[3]);
	        if(timeTotal_1==periodInfo1[0]){
	            total_1=parseFloat(price9[0]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price9[0];
	        }else if(timeTotal_1==periodInfo1[1]){
	            total_1=parseFloat(price9[1]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price9[1];
	        }else if(timeTotal_1==periodInfo1[2]){
	            total_1=parseFloat(price9[2]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price9[2];
	        }else if(timeTotal_1==periodInfo1[3]){
	            total_1=parseFloat(price9[3]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price9[3];
	        }else if(timeTotal_1==periodInfo1[4]){
	            total_1=parseFloat(price9[4]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price9[4];
	        }else if(timeTotal_1==periodInfo1[5]){
	            total_1=parseFloat(price9[5]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price9[5];
	        }
	        break;
	        case '100':
	        $('.i-ip').html(num1[4]);
	        if(timeTotal_1==periodInfo1[0]){
	            total_1=parseFloat(price10[0]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price10[0];
	        }else if(timeTotal_1==periodInfo1[1]){
	            total_1=parseFloat(price10[1]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price10[1];
	        }else if(timeTotal_1==periodInfo1[2]){
	            total_1=parseFloat(price10[2]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price10[2];
	        }else if(timeTotal_1==periodInfo1[3]){
	            total_1=parseFloat(price10[3]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price10[3];
	        }else if(timeTotal_1==periodInfo1[4]){
	            total_1=parseFloat(price5[4]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price10[4];
	        }else if(timeTotal_1==periodInfo1[5]){
	            total_1=parseFloat(price10[5]/spaceTotal_1/timeTotal_1/12);
	            cost_money_1=price10[5];
	        }
	        break;

		 }
	}
	   //IP数量输入时
	    if(count_1==''||count_1==0){
	        cost_money_str_1_1=''; 
	        cost_money_1_1=0;
	    }else{
	        cost_money_str_1_1=' *IP数量：'+count_1+'个('+unitIP+'元/月/个)'; 
	        cost_money_1_1=unitIP*count_1*timeTotal_1*12;
	    }


	             //计算费用

	            var cost_money_str_1 = '带宽：'+spaceTotal_1+'M ('+total_1.toFixed(2)+'元/M/月) '+cost_money_str_1_1+'* 时长：'+timeTotal_1*12+'个月';//+'='+cost_money+'元';;          

	             cost_money_str_1+='= 总计：'+(parseFloat(cost_money_1)+parseFloat(cost_money_1_1))+'元';
	  
	             $("#total_money2").val((parseFloat(cost_money_1)+parseFloat(cost_money_1_1))); //modified by liaoliyun
	            //模板赋值
	           //  $("#cost_money_1").val(cost_money);//隐蔽域存放金额
	            // $("#pDate_1").html(pDate_1);
	            $("#cost_money_show_1").html(cost_money_str_1);
	            $("#cost_money_show_1").show();
	            $(".i-month").html(timeTotal_1);
	            $(".i-line").html(spaceTotal_1);
	    }
  
//IDC计价
  function stairPrice_2(){
    var total_2;
    var cost_money_2;  
    var cost_money_3;
    var cost_money_4;

   var  cost_money_str_2_1;
   var  cost_money_str_2_2;

    create_section_2();
    
    //区间段
    var spaceSectionNum=$("#spaceSectionNum").val();
    var timeSectionNum=$("#timeSectionNum").val();
    //购买量
    var spaceTotal_2=$("#tot_volume_2").val();
    var timeTotal_2=$("#buy_num_2").val();
    var count_2=$('#buy_count_2').val();    
    var count_4=$('#buy_count_4').val();    

    if(flag=="one"){
        
        switch(spaceTotal_2){
            case '10':
            $('.i-ip').html(num2[0]);
            total_2=price11[0];
            cost_money_2=timeTotal_2*total_2*12;
            break;
            case '20':
            $('.i-ip').html(num2[1]);
            total_2=price11[1];
            cost_money_2=timeTotal_2*total_2*12;
            break;
             case '30':
            $('.i-ip').html(num2[2]);
            total_2=price11[2];
            cost_money_2=timeTotal_2*total_2*12;
            break;  
             case '50':
            $('.i-ip').html(num2[3]);
            total_2=price11[3];
            cost_money_2=timeTotal_2*total_2*12;
            break;  
             case '100':
            $('.i-ip').html(num2[4]);
            total_2=price11[4];
            cost_money_2=timeTotal_2*total_2*12;
            break; 
             case '300':
            $('.i-ip').html(num2[5]);
            total_2=price11[5];
            cost_money_2=timeTotal_2*total_2*12;
            break; 
             case '500':
            $('.i-ip').html(num2[6]);
            total_2=price11[6];
            cost_money_2=timeTotal_2*total_2*12;
            break; 
             case '1024':
            $('.i-ip').html(num2[7]);
            total_2=price11[7];
            cost_money_2=timeTotal_2*total_2*12;
            break; 
        }

    }else{
        switch(spaceTotal_2){
            case '10':
            $('.i-ip').html(num2[0]);
            total_2=price13[0];
            cost_money_2=timeTotal_2*total_2*12;
            break;
            case '20':
            $('.i-ip').html(num2[1]);
            total_2=price13[1];
            cost_money_2=timeTotal_2*total_2*12;
            break;
             case '30':
            $('.i-ip').html(num2[2]);
            total_2=price13[2];
            cost_money_2=timeTotal_2*total_2*12;
            break;  
             case '50':
            $('.i-ip').html(num2[3]);
            total_2=price13[3];
            cost_money_2=timeTotal_2*total_2*12;
            break;  
             case '100':
            $('.i-ip').html(num2[4]);
            total_2=price13[4];
            cost_money_2=timeTotal_2*total_2*12;
            break; 
             case '300':
            $('.i-ip').html(num2[5]);
            total_2=price13[5];
            cost_money_2=timeTotal_2*total_2*12;
            break; 
             case '500':
            $('.i-ip').html(num2[6]);
            total_2=price13[6];
            cost_money_2=timeTotal_2*total_2*12;
            break; 
             case '1024':
            $('.i-ip').html(num2[7]);
            total_2=price13[7];
            cost_money_2=timeTotal_2*total_2*12;
            break; 
        }
    }

      //机柜机架选择时
    var index=$('#options').children('option:selected').index();
       if(index==0){
        cost_money_3=0;
        cost_money_str_2_1='';
       }else if(index==1){        
                 cost_money_3=price15*count_4*timeTotal_2*12;
                 if(count_4==''||count_4==0){
                     cost_money_str_2_1='';
                 }else{
                    cost_money_str_2_1='*机架尺寸：'+count_4+'U('+price15+'元/U/月)';
                 }
                
        }else if(index==2){

            var index1=$('#option-1 select').children('option:selected').index();
            if(index1==0){
                cost_money_3=0;
                cost_money_str_2_1='';
            }else if(index1==1){
                cost_money_3=price12*timeTotal_2*12;
                cost_money_str_2_1='*机柜尺寸：10A42U('+price12+'元/月)';
            }else if(index1==2){
                cost_money_3=price14*timeTotal_2*12;
                cost_money_str_2_1='*机柜尺寸：13A42U('+price14+'元/月)';
            }
        }


   //IP数量输入时
    if(count_2==''||count_2==0){
        cost_money_str_2_2=''; 
        cost_money_4=0;
    }else{
        cost_money_str_2_2='*IP数量：'+count_2+'个('+unitIP+'元/月/个)'; 
        cost_money_4=count_2*unitIP*timeTotal_2*12;
    }

         //计算费用

        var cost_money_str_2 = '带宽：'+spaceTotal_2+'M ('+total_2+'元/月)'+cost_money_str_2_2+cost_money_str_2_1+'* 时长：'+timeTotal_2*12+'个月';

       

         cost_money_str_2+='= 总计：'+(cost_money_2+cost_money_4+cost_money_3)+'元';

         $("#total_money").val(cost_money_2+cost_money_4+cost_money_3);
        //模板赋值
        // $("#cost_money_2").val(cost_money);//隐蔽域存放金额
        $("#cost_money_show_2").html(cost_money_str_2);
        $("#cost_money_show_2").show();
        $(".i-month").html(timeTotal_2);
        $(".i-line").html(spaceTotal_2);
    }


   //ISP
    function create_section_1(){
      //购买量
      var spaceTotal=$("#tot_volume_1").val();
      var timeTotal=$("#buy_num_1").val();
      
           //获取手动输入的容量值
      var sid_1=0;
      var tot_volume_1 = parseInt($("#tot_volume_1").val());
      var max_volume_1 = spaceInfo1[spaceInfo1.length-1]//'1000';
      var min_volume_1 = spaceInfo1[0]//'10';
                
                
     var num_1 = spaceInfo1.length;
              if(tot_volume_1 > max_volume_1){
                  $("#tot_volume_1").val(max_volume_1);
                  sid_1 = spaceInfo.length-1;
              }else if(tot_volume_1 < min_volume_1){
                  $("#tot_volume_1").val(min_volume_1);
                  sid_1 = 0;
              }else{
                 for(var key in spaceInfo){
                    if((tot_volume_1 >= spaceInfo[key]) && (tot_volume_1 <= spaceInfo[key+1])){
                       sid_1 = parseInt(key);
                      
                      break;
                    }
                 }
              }
              
             var tid_1 =0;
             var buy_num_1 = parseInt($("#buy_num_1").val());
             var max_month_1 = periodInfo1[periodInfo1.length-1];
             var min_month_1 = periodInfo1[0];

             if(buy_num_1>max_month_1){
                 $("#buy_num_1").val(max_month_1);
                 tid_1=periodInfo1.length-1;
                 
             }else if(buy_num_1<min_month_1){
                 $("#buy_num_1").val(min_month_1);
                 tid_1=0;
             }
             else{
                  for(var key in periodInfo1){
                    if(buy_num_1 = periodInfo1[key]){
                       tid_1 = parseInt(key);
                      break;
                    }
             }
    }
      $("#spaceSectionNum_1").val(++sid_1);//空间区间
      $("#timeSectionNum_1").val(++tid_1);//时间区间

    
    }
   //加速
    function create_section_2(){
      //购买量
      var spaceTotal=$("#tot_volume").val();
      var timeTotal=$("#buy_num").val();
      
           //获取手动输入的容量值
      var sid_2=0;
      var tot_volume_2 = parseInt($("#tot_volume").val());
      var max_volume_2 = spaceInfo[spaceInfo.length-1]//'1000';
      var min_volume_2 = spaceInfo[0]//'10';
                
                
     var num_2 = spaceInfo.length;
              if(tot_volume_2 > max_volume_2){
                  $("#tot_volume_2").val(max_volume_2);
                  sid_2 = spaceInfo.length-1;
              }else if(tot_volume_2 < min_volume_2){
                  $("#tot_volume_2").val(min_volume_2);
                  sid_2 = 0;
              }else{
                 for(var key in spaceInfo){
                    if((tot_volume_2 >= spaceInfo[key]) && (tot_volume_2 <= spaceInfo[key+1])){
                       sid_2 = parseInt(key);
                      
                      break;
                    }
                 }
              }
              
             var tid_2 =0;
             var buy_num_2 = parseInt($("#buy_num_2").val());
             var max_month_2 = periodInfo[periodInfo.length-1];
             var min_month_2 = periodInfo[0];

             if(buy_num_2>max_month_2){
                 $("#buy_num_2").val(max_month_2);
                 tid_2=periodInfo.length-1;
                 
             }else if(buy_num_2<min_month_2){
                 $("#buy_num_2").val(min_month_2);
                 tid_2=0;
             }
             else{
                  for(var key in periodInfo){
                    if(buy_num_2 = periodInfo[key]){
                       tid_2 = parseInt(key);
                      break;
                    }
             }
    }
      $("#spaceSectionNum_2").val(++sid_2);//空间区间
      $("#timeSectionNum_2").val(++tid_2);//时间区间

    
    }



        function create_section(){
      //购买量
      var spaceTotal=$("#tot_volume").val();
      var timeTotal=$("#buy_num").val();
      
           //获取手动输入的容量值
      var sid=0;
      var tot_volume = parseInt($("#tot_volume").val());
      var max_volume = spaceInfo[spaceInfo.length-1]//'1000';
      var min_volume = spaceInfo[0]//'10';
                
                
     var num = spaceInfo.length;
              if(tot_volume > max_volume){
                  $("#tot_volume").val(max_volume);
                  sid = spaceInfo.length-1;
              }else if(tot_volume < min_volume){
                  $("#tot_volume").val(min_volume);
                  sid = 0;
              }else{
                 for(var key in spaceInfo){
                    if((tot_volume >= spaceInfo[key]) && (tot_volume <= spaceInfo[key+1])){
                       sid = parseInt(key);
                      
                      break;
                    }
                 }
              }
              
             var tid =0;
             var buy_num = parseInt($("#buy_num").val());
             var max_month = periodInfo[periodInfo.length-1];
             var min_month = periodInfo[0];

             if(buy_num>max_month){
                 $("#buy_num").val(max_month);
                 tid=periodInfo.length-1;
                 
             }else if(buy_num<min_month){
                 $("#buy_num").val(min_month);
                 tid=0;
             }
             else{
                  for(var key in periodInfo){
                    if(buy_num = periodInfo[key]){
                       tid = parseInt(key);
                      break;
                    }
             }
    }
      $("#spaceSectionNum").val(++sid);//空间区间
      $("#timeSectionNum").val(++tid);//时间区间

    
    }
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 
//-------------空间结束 ------   
  //公共：
    //获取有效日期
        function getPDate(add_month){
            var m = new Date().getMonth()+1+parseInt(add_month); 
            var d = new Date(new Date().getFullYear(),m,new Date().getDate()); 
            var year = d.getFullYear();
            var month = d.getMonth()+1;
             if(month == 0){
               month = 12; 
               year = d.getFullYear()-1;
            }
            var day = d.getDate();
            var date = year + "年" + (month) + "月" + day + "日";

      var date1 = year + "-" + (month) + "-" + day;
      if(document.getElementById("end_time") != undefined)
      {
      console.log(document.getElementById("end_time").value);
      var end_time=document.getElementById("end_time").value=date1;
      }

            return date;
        }

    //容量计算
    $(document).ready(function() {
      
         $(".ui-slider-handle").html("<i></i><i></i><i></i>");

    var slider = $("#slider").slider({
            values:[],
            animate:true,
            min:0,
            max:1000,
            step:40,
            range:'min',
            change: function( event, ui ) {   
                  
                 // $("#tot_volume").val(parseInt(ui.value/2));
                 // alert(ui.value)

                 if(ui.value<200){
                  alert('对不起，最小存储容量不能小于50M');
                  $("#tot_volume").val(50);
                  

                }else if(ui.value<=400 && ui.value>200){
                  $("#tot_volume").val(100);
                             
                }else if(ui.value<=600 && ui.value>400){
                  $("#tot_volume").val(200)
                }else if(ui.value<=800 && ui.value>600){
                  $("#tot_volume").val(500)
                }else if(ui.value<=1000 && ui.value>800){
                  $("#tot_volume").val(1000);
                }


                 $(".re1_t1").html("&nbsp;M");
                // //计算费用
                 stairPrice();


            }
        });
      //ISP 带宽
     var slider_1 = $("#slider_1").slider({
            values:[],
            animate:true,
            min:0,
            max:100,
            step:10,
            range:'min',
            change: function( event, ui ) {   
                  
                if(ui.value<=20){
                  $("#tot_volume_1").val(10);
                }else if(ui.value<=40 && ui.value>20){
                  $("#tot_volume_1").val(20);                         
                }else if(ui.value<=60 && ui.value>40){
                  $("#tot_volume_1").val(30);
                }else if(ui.value<=80 && ui.value>60){
                  $("#tot_volume_1").val(50);
                }else if(ui.value<=100 && ui.value>80){
                  $("#tot_volume_1").val(100);
                }

                 $(".re1_t1").html("&nbsp;M");
                 //计算费用
                 stairPrice_1();


            }
        });

      //IDC 带宽     
     var slider_2 = $("#slider_2").slider({
            values:[],
            animate:true,
            min:0,
            max:1024,
            step:100,
            range:'min',
            change: function( event, ui ) {   
                  
                if(ui.value<=100){
                  $("#tot_volume_2").val(10);
                }else if(ui.value<=200 && ui.value>100){
                  $("#tot_volume_2").val(20);                         
                }else if(ui.value<=400 && ui.value>200){
                  $("#tot_volume_2").val(30);
                }else if(ui.value<=500 && ui.value>400){
                  $("#tot_volume_2").val(50);
                }else if(ui.value<=600 && ui.value>500){
                  $("#tot_volume_2").val(100);
                }else if(ui.value<=700 && ui.value>600){
                  $("#tot_volume_2").val(300);
                }else if(ui.value<=900 && ui.value>700){
                  $("#tot_volume_2").val(500);
                }else if(ui.value<=1000 && ui.value>900){
                  $("#tot_volume_2").val(1024);
                }


                 $(".re1_t1").html("&nbsp;M");
                // //计算费用
                 stairPrice_2();


            }
        });


        //拖拽时长滑条产生的费用计算
        var slider_time = $("#slider_time").slider({
            values:[],
            animate:true,
            min:0,
            max:12,
            step:1,
            range:'min',
            change: function( event, ui ) {
                var num = periodInfo.length;

                var uwidth = parseInt(100/num);
                var pid = 0;
               
               
                // if(ui.value > (num) * uwidth) {ui.value = pid * uwidth;}
                //计算滑条移动产生的月份数
                $("#buy_num").val(ui.value)
                
                
                $(".re1_t2").html("&nbsp;月");
                $(".i-month").html(ui.value);
                 //计算费用
                 stairPrice();

            }
        });

        //ISP 时长
        var slider_time_1 = $("#slider_time_1").slider({
            values:[],
            animate:true,
            min:0,
            max:6,
            step:1,
            range:'min',
            change: function( event, ui ) {
                var num = periodInfo.length;

                var uwidth = parseInt(100/num);
                var pid = 0;
               
               
                // if(ui.value > (num) * uwidth) {ui.value = pid * uwidth;}
                //计算滑条移动产生的年份数
                $("#buy_num_1").val(ui.value)
                
                
                $(".re1_t2").html("&nbsp;年");
                 //计算费用
                 stairPrice_1();

            }
        });
    
        var slider_time_2 = $("#slider_time_2").slider({
            values:[],
            animate:true,
            min:0,
            max:6,
            step:1,
            range:'min',
            change: function( event, ui ) {
                var num = periodInfo.length;

                var uwidth = parseInt(100/num);
                var pid = 0;
               
               
                // if(ui.value > (num) * uwidth) {ui.value = pid * uwidth;}
                //计算滑条移动产生的月份数
                $("#buy_num_2").val(ui.value)
                
                
                $(".re1_t2").html("&nbsp;年");
                 //计算费用
                 stairPrice_2();

            }
        });

    	function tot_volume(){
               //获取手动输入的容量值
              var sid;
              var tot_volume = parseInt($("#tot_volume").val());
              var max_volume = spaceInfo[spaceInfo.length-1];

              var min_volume = spaceInfo[0];
              
              var num = spaceInfo.length;

              if(tot_volume > max_volume){
                  alert("对不起，最大存储容量不能超过"+max_volume+"M");
                  $("#tot_volume").val(max_volume);
                  tot_volume = max_volume;
                  sid = spaceInfo.length-1;

              }else if(tot_volume < min_volume){
                  alert("对不起，最小存储容量不能小于"+min_volume+"M");
                  $("#tot_volume").val(min_volume);
                  tot_volume = min_volume;
                  sid = 0;
              }else{
                 for(var key in spaceInfo){
                    if((tot_volume >= spaceInfo[key]) && (tot_volume <= spaceInfo[key+1])){
                      sid = parseInt(key);
                  
                      break;
                    }
                 }
              }
              
             //尝试计算一个拖拽滑条的长度，这个滑条的长度只能即可能的精确。所以拖拽滑条的长度不能用来计算容量
             
            //根据手动输入容量的值计算费用。
            var buy_num = $("#buy_num").val();

            var tot_volume_2;

           if(tot_volume==50){
            tot_volume_2=tot_volume*4;
           }
           else if(tot_volume<100&&tot_volume>50)
              {
              tot_volume_2=tot_volume*4;
           }else if(tot_volume==100)
               {
               tot_volume_2=tot_volume*4;
            }else if(tot_volume<200 &&tot_volume>100)
               {
               tot_volume_2=tot_volume*4;
            }else if(tot_volume==200)
               {
              tot_volume_2=tot_volume*3;
            }
            else if(tot_volume<500 &&tot_volume>200)
               {
               tot_volume_2=tot_volume*2.5;
            }else if(tot_volume==500)
              {
              tot_volume_2=tot_volume*1.6;
            }else if(tot_volume<1000 &&tot_volume>500)
              {
              tot_volume_2=tot_volume*1.2;

            }else if(tot_volume==1000)
               {
               tot_volume_2=tot_volume*1.07;
          
            }

            slider.slider( "value", tot_volume_2);
           $("#spaceSectionNum").val(sid+1);//隐蔽域记下 当前位于哪个计费区间
            
           $("#tot_volume").val(tot_volume);
            stairPrice();
        }	
              
      // function tot_volume_1(){
      //          //获取手动输入的容量值
      //         var sid_1;
      //         var tot_volume_1 = parseInt($("#tot_volume_1").val());
      //         var max_volume_1 = spaceInfo1[spaceInfo.length-1];

      //         var min_volume_1 = spaceInfo1[0];
              
      //         var num_1 = spaceInfo1.length;

      //         if(tot_volume_1 > max_volume_1){
      //             alert("对不起，最大存储容量不能超过"+max_volume_1+"M");
      //             $("#tot_volume_1").val(max_volume_1);
      //             tot_volume_1 = max_volume_1;
      //             sid_1 = spaceInfo.length-1;

      //         }else if(tot_volume_1 < min_volume_1){
      //             alert("对不起，最小存储容量不能小于"+min_volume_1+"M");
      //             $("#tot_volume_1").val(min_volume_1);
      //             tot_volume_1 = min_volume_1;
      //             sid_1 = 0;
      //         }else{
      //            for(var key in spaceInfo1){
      //               if((tot_volume_1 >= spaceInfo1[key]) && (tot_volume_1 <= spaceInfo1[key+1])){
      //                 sid_1 = parseInt(key);
                  
      //                 break;
      //               }
      //            }
      //         }
              
      //        //尝试计算一个拖拽滑条的长度，这个滑条的长度只能即可能的精确。所以拖拽滑条的长度不能用来计算容量
             
      //       //根据手动输入容量的值计算费用。
      //       var buy_num_1 = $("#buy_num_1").val();
            
      //      $("#spaceSectionNum_1").val(sid_1+1);//隐蔽域记下 当前位于哪个计费区间

      //      var tot_volume_2;
      //       stairPrice_1();
      //   } 

      // function tot_volume_2(){
      //          //获取手动输入的容量值
      //         var sid_2;
      //         var tot_volume_2 = parseInt($("#tot_volume_2").val());
      //         var max_volume_2 = spaceInfo[spaceInfo.length-1];

      //         var min_volume_2 = spaceInfo[0];
              
      //         var num_2 = spaceInfo.length;

      //         if(tot_volume_2 > max_volume_2){
      //             alert("对不起，最大存储容量不能超过"+max_volume_2+"M");
      //             $("#tot_volume_2").val(max_volume_2);
      //             tot_volume_2 = max_volume_2;
      //             sid_2 = spaceInfo.length-1;

      //         }else if(tot_volume_2 < min_volume_2){
      //             alert("对不起，最小存储容量不能小于"+min_volume_2+"M");
      //             $("#tot_volume_2").val(min_volume_2);
      //             tot_volume_2 = min_volume_2;
      //             sid_2 = 0;
      //         }else{
      //            for(var key in spaceInfo){
      //               if((tot_volume_2 >= spaceInfo[key]) && (tot_volume_2 <= spaceInfo[key+1])){
      //                 sid_2 = parseInt(key);
                  
      //                 break;
      //               }
      //            }
      //         }
              
      //        //尝试计算一个拖拽滑条的长度，这个滑条的长度只能即可能的精确。所以拖拽滑条的长度不能用来计算容量
             
      //       //根据手动输入容量的值计算费用。
      //       var buy_num_2 = $("#buy_num_2").val();
            
      //      $("#spaceSectionNum_2").val(sid_2+1);//隐蔽域记下 当前位于哪个计费区间

      //      var tot_volume_2_1;

      //      if(tot_volume_2<=10){
      //       tot_volume_2_1=tot_volume_2*10;
      //      }else if(tot_volume_2<=50 &&tot_volume_2>10)
      //         {
      //         tot_volume_2_1=tot_volume_2*2.5;
      //      }else if(tot_volume_2<=100 &&tot_volume_2>50)
      //         {
      //         tot_volume_2_1=tot_volume_2*1.6;
      //      }else if(tot_volume_2<=150 &&tot_volume_2>100)
      //         {
      //         tot_volume_2_1=tot_volume_2*1.5;
      //      }else if(tot_volume_2<=200 &&tot_volume_2>150)
      //         {
      //         tot_volume_2_1=tot_volume_2*1.42;
      //      }else if(tot_volume_2<=250 &&tot_volume_2>200)
      //         {
      //         tot_volume_2_1=tot_volume_2*1.28;
      //      }else if(tot_volume_2<=300 &&tot_volume_2>250)
      //         {
      //         tot_volume_2_1=tot_volume_2*1.2;
      //      }else if(tot_volume_2<=400 &&tot_volume_2>300)
      //         {
      //         tot_volume_2_1=tot_volume_2*1.1;

      //      }else if(tot_volume_2<=500 &&tot_volume_2>400)
      //         {
      //         tot_volume_2_1=tot_volume_2*1.07;
          
      //      }else if(tot_volume_2<=600 &&tot_volume_2>500)
      //         {
      //         tot_volume_2_1=tot_volume_2*1.07;
      //      }else if(tot_volume_2<=700 &&tot_volume_2>600)
      //         {
      //         tot_volume_2_1=tot_volume_2*1.04;
            
      //      }else if(tot_volume_2<=800 &&tot_volume_2>700)
      //         {
      //         tot_volume_2_1=tot_volume_2*1.02;
            
      //      }else if(tot_volume_2<=900 &&tot_volume_2>800)
      //         {
      //         tot_volume_2_1=tot_volume_2*1;
            
      //      }else if(tot_volume_2<=1000 &&tot_volume_2>900)
      //         {
      //         tot_volume_2_1=tot_volume_2*0.96;
      //       }


      //       slider_2.slider( "value", tot_volume_2_1);
      //      $("#tot_volume_2").val(tot_volume_2);
      //       stairPrice_2();
      //   } 



        function buy_num(){

            var periodInfo=[1,2,3,4,5,6,7,8,9,10,11,12];

             var sid =0;
             var buy_num = parseInt($("#buy_num").val());

             var max_month = periodInfo[periodInfo.length-1];
             
             var min_month = periodInfo[0];
            
             if(buy_num>max_month){
                 alert("使用时长最多为"+max_month+"个月");
                 $("#buy_num").val(max_month);
                 buy_num = max_month;
                 sid=periodInfo.length-1;

                 
             }else if(buy_num<min_month){
                 alert("对不起，使用时长不能小于"+min_month+"月");
                 $("#buy_num").val(min_month);
                 buy_num = min_month;
                 sid=0;
             }
             else{
                  for(var key in periodInfo){
                    if(buy_num == periodInfo[key]){
                       sid = parseInt(key);
                      break;

                    }
                }
             }

             // var uwidth=buy_num*12;
            

            //  //根据手动输入时长计算费用。
            var tot_volume = $("#tot_volume").val();
            $("#timeSectionNum").val(sid+1);//隐蔽域记下 当前位于哪个计费区间
             slider_time.slider( "value", buy_num);
            // $("#buy_num").val(buy_num);
            stairPrice();
	}
  //    function buy_num_1(){

  //           var periodInfo1=[1,2,3,4,5,6];

  //            var sid=0;
  //            var buy_num = parseInt($("#buy_num_1").val());

  //            var max_month = periodInfo1[periodInfo1.length-1];
             
  //            var min_month = periodInfo1[0];
            
  //            if(buy_num>max_month){
  //                alert("使用时长最多为"+max_month+"年");
  //                $("#buy_num_1").val(max_month);
  //                buy_num = max_month;
  //                sid=periodInfo1.length-1;

                 
  //            }else if(buy_num<min_month){
  //                alert("对不起，使用时长不能小于"+min_month+"年");
  //                $("#buy_num_1").val(min_month);
  //                buy_num = min_month;
  //                sid=0;
  //            }
  //            else{
  //                 for(var key in periodInfo1){
  //                   if(buy_num == periodInfo1[key]){
  //                      sid = parseInt(key);
  //                     break;

  //                   }
  //               }
  //            }

  //            // var uwidth=buy_num*12;
            

  //           //  //根据手动输入时长计算费用。
  //           var tot_volume = $("#tot_volume_1").val();
  //           $("#timeSectionNum_1").val(sid+1);//隐蔽域记下 当前位于哪个计费区间
  //            slider_time_1.slider( "value", buy_num);
  //           // $("#buy_num").val(buy_num);
  //           stairPrice_1();
  // }

  //    function buy_num_2(){

  //           var periodInfo=[1,2,3,4,5,6,7,8,9,10,11,12];

  //            var sid=0;
  //            var buy_num = parseInt($("#buy_num_2").val());

  //            var max_month = periodInfo[periodInfo.length-1];
             
  //            var min_month = periodInfo[0];
            
  //            if(buy_num>max_month){
  //                alert("使用时长最多为"+max_month+"个月");
  //                $("#buy_num_2").val(max_month);
  //                buy_num = max_month;
  //                sid=periodInfo.length-1;

                 
  //            }else if(buy_num<min_month){
  //                alert("对不起，使用时长不能小于"+min_month+"月");
  //                $("#buy_num_2").val(min_month);
  //                buy_num = min_month;
  //                sid=0;
  //            }
  //            else{
  //                 for(var key in periodInfo){
  //                   if(buy_num == periodInfo[key]){
  //                      sid = parseInt(key);
  //                     break;

  //                   }
  //               }
  //            }

  //            // var uwidth=buy_num*12;
            

  //           //  //根据手动输入时长计算费用。
  //           var tot_volume = $("#tot_volume_2").val();
  //           $("#timeSectionNum_2").val(sid+1);//隐蔽域记下 当前位于哪个计费区间
  //            slider_time_2.slider( "value", buy_num);
  //           // $("#buy_num").val(buy_num);
  //           stairPrice_2();
  // }


	     //监听buy_num输入回车事件
       //  $("#buy_num").keypress(function(e){
       //       switch(e.which)    
       //       {    
       //          case 13:  buy_num();
   

                
       //       }      
       //  })

       // $("#buy_num_1").keypress(function(e){
       //       switch(e.which)    
       //       {    
       //          case 13:  buy_num_1();
   

                
       //       }      
       //  })

       // $("#buy_num_2").keypress(function(e){
       //       switch(e.which)    
       //       {    
       //          case 13:  buy_num_2();
   

                
       //       }      
       //  })
       //  $("#tot_volume").keypress(function(e){
       //       switch(e.which)    
       //       {    
       //          case 13:tot_volume();  
                
       //       }    
       //  })
       //  $("#tot_volume_1").keypress(function(e){
       //       switch(e.which)    
       //       {    
       //          case 13:tot_volume_1();  
                
       //       }    
       //  })

       //    $("#tot_volume_2").keypress(function(e){
       //       switch(e.which)    
       //       {    
       //          case 13:tot_volume_2();  
                
       //       }    
       //  })      

        //手动输入数量触发的费用更改
        // $("#buy_num").blur(function(){
        //    buy_num();  
        // })        //手动输入数量触发的费用更改
        // $("#buy_num_1").blur(function(){
        //    buy_num_1();  
        // })
        //  $("#buy_num_2").blur(function(){
        //    buy_num_2();  
        // })
       

        //手动输入容量触发的费用更改
        // $("#tot_volume").blur(function(){
        // if($.trim($("#tot_volume").val())=="")
        //   $("#tot_volume").val(1);
        //    tot_volume();
        // })
        // //手动输入容量触发的费用更改
        // $("#tot_volume_1").blur(function(){
        // if($.trim($("#tot_volume_1").val())=="")
        //   $("#tot_volume_1").val(1);
        //    tot_volume_1();
        // })
        // //手动输入容量触发的费用更改
        // $("#tot_volume_2").blur(function(){
        // if($.trim($("#tot_volume_2").val())=="")
        //   $("#tot_volume_2").val(1);
        //    tot_volume_2();
        // })

        
        create_section();
        // tot_volume();
        // buy_num();   

       // create_section_1();
        // tot_volume_1();
        // buy_num_1();   

        create_section_2();
        // tot_volume_2();
        // buy_num_2();  


    });

    //点击加速类型    
    // $("#spaceUpType li").eq(0).click(function(){
    // $(this).toggleClass("cur")
    // if($("#spaceUpType .cur").size()<1)
    // {alert("至少选择一项服务！");
    // $("#spaceUpType li:first").addClass("cur");//至少选择一项
    // }
    // stairPrice();
    // return false;
    // })


    
 //   $.formValidator.initConfig({autotip:true,formid:"myform",onerror:function(msg){}});
